<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>借阅信息</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style>
        .main{
            width:100%;
            height:100%;
            /* background:red;*/
            display:flex;
            flex-wrap: wrap;
            flex-direction:row;
            justify-content: start;
        }
        .query-div{
            display:flex;
            flex-wrap: wrap;
            flex-direction:row;
            justify-content: start;
        }
        .left-menu{
            width:12%;
            height: 90%;
            /*background:yellow;*/
        }
        .right-content{
            width: 85%;
            height:80%;
            margin-left: 32px;
            align-content: center;
            /*   background:blue;*/
        }
        .top-head-color{
            background-color: #50afeb ;

        }

    </style>
</head>
<body>
<%--顶部--%>
<nav class="navbar navbar-default top-head-color" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">图书馆管理系统</a>
        </div>
        <ul class="nav navbar-nav navbar-right">
            <li ><a disabled="disabled"><span class="glyphicon glyphicon-user "></span> 欢迎您，${user.name}</a></li>
            <li ><a href="${pageContext.request.contextPath}/logoutServlet"><span class="glyphicon glyphicon-log-out"></span> 注销</a></li>
        </ul>
    </div>
</nav>
<div class="main">
<%--    左侧菜单栏--%>
    <div class="left-menu">
        <ul class="nav nav-pills nav-stacked">
            <li ><a href="${pageContext.request.contextPath}/bookListServlet">图书查询</a></li>
            <li class="active"><a href="${pageContext.request.contextPath}/borrowListByUserServlet">借阅信息</a></li>
            <li><a href="${pageContext.request.contextPath}/borrowBookHistoryListByUserServlet">借阅历史</a></li>
        </ul>
    </div>
<%--    <div style="background-color: #9d9d9d;width: 0.5px;height: 90%"></div>--%>
<%--    右侧--%>
    <div class="right-content">
        <div class="query-div">
            <div class="col-lg-7 form-group">

                <form action="${pageContext.request.contextPath}/queryBookListServlet" method="post">
                    <div class="col-lg-8">
                        <input class="form-control"  name="queryBookName" placeholder="查询书名称" type="text" value="">
                    </div>
                    <input type="submit" class="btn btn-primary" id="query" data-toggle="modal" value="查询" />
                </form>
            </div>
        </div>

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>图书号</th>
                <th>图书名称</th>
                <th>读者账号</th>
                <th>读者姓名</th>
                <th>借阅日期</th>
                <th>截止还书日期</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${borrowBookListByUser}" var="history" varStatus="status">
                <tr>
                    <td>${history.card}</td>
                    <td>${history.bookname}</td>
                    <td>${history.adminname}</td>
                    <td>${history.username}</td>
                    <td>${history.begintime}</td>
                    <td>${history.endtime}</td>
                    <td>
                        <button type="button" class="btn btn-info btn-xs" onclick="bookReturn('${history.hid}')">还书</button>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>

</div>


<script>

    function bookReturn(hid){
        con=confirm("是否还书?");
        if(con==true){
            location.href = "${pageContext.request.contextPath}/bookReturnServlet?returnBookId="+hid;

        }
    }



</script>





</body>
</html>
